<?php

/**
 * This file is part of the Codizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Codizer Core Team <team@codizer.org>
 * @package     Codizer
 */

function smarty_function_imageUrl($params, &$smarty)
{
	if(!isset($params['file']) || is_null($params['file']) || $params['file'] == "")
	{
		return '';
	}

	$theme = f_core_Context::getInstance()->getContext("currentWebsite")->getTheme();

    if(substr($params['file'], 0, 1) == '/')
    {
        $params['file'] = substr($params['file'], 1, -1);
    }

	$path = URL_RELATIVE.'/themes/'.$theme.'/frontend/images/'.$params['file'];

    return $path;
}